package com.cip.master.action;

import com.cip.admin.model.User;
import com.cip.common.util.SecurityUtil;
import com.cip.master.model.Blog;
import com.cip.master.model.Comments;
import com.cip.master.service.BlogService;
import com.cip.webapp.action.BaseAction;

public class CommentAction extends BaseAction{
	
	private Blog blog;
	private Comments comments;
	private BlogService blogService;
	
	public String saveOrUpdateComments() throws Exception{
		try{
		User user = SecurityUtil.threadLocalUser.get();
		comments.setTenantId(user.getTenantId());
		comments.setUser(user);
		System.out.println("blog=======" + blog.getId());
		comments.setBlog(blog);
		System.out.println("tenantid---"+ user.getTenantId() + "===userId====" +  user.getId());
		blogService.saveOrUpdateComment(comments);
		}catch(Exception e){
			e.printStackTrace();
		}
		return SUCCESS;
	}

	public Blog getBlog() {
		return blog;
	}

	public void setBlog(Blog blog) {
		this.blog = blog;
	}

	public Comments getComments() {
		return comments;
	}

	public void setComments(Comments comments) {
		this.comments = comments;
	}

	public BlogService getBlogService() {
		return blogService;
	}

	public void setBlogService(BlogService blogService) {
		this.blogService = blogService;
	}
	
}